import { store } from "@/redux/index";

/**
 * @description 按钮权限
 * */
const AuthButton = (props: { permission: string, children: JSX.Element }) => {
	const { permission } = props;
	const permissions = store.getState().auth.permissions;
	if (permissions.indexOf(permission) == -1) return <></>;

	// * 当前账号有权限，正常访问按钮
	return props.children;
};

export default AuthButton;
